<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<!DOCTYPE p PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<fmt:setBundle basename="bundles.railroadIndexBundle" />

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title><fmt:message key="index.registration"></fmt:message></title>
<script type="text/javascript" src="/layout/jsc/jquery.min.js"></script>
<script type="text/javascript" src="/layout/jsc/jquery.validate.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('#request_form').validate({
			rules : {
				login : "required",
				name : "required",
				surname : "required",
				pass : {
					minlength : 5
				},
				pass_retry : {
					minlength : 5,
					equalTo : "#password"
				},
				email : {
					required : true,
					email : true
				}
			},
			messages : {
				name : "Please enter your name",
				surname : "Please enter your surname",
				password : {
					required : "Please enter your password",
					minlegth : "Password must be more than 5 symbols"
				},
				password : {
					required : "Please enter your password",
					minlegth : "Password must be more than 5 symbols",
					equalTo : "Passwords does not match"
				},
				email : {
					required : "Please enter your valid email"
				}
			}

		});
	});
</script>

</head>

<body>

<c:set var="wrongLogin" value="${sessionScope['wrongLogin']}"></c:set>

<c:if test="${not empty wrongLogin }">
<h1 align="center"><fmt:message key="register.wronglogin"></fmt:message></h1>
</c:if>

<form method="post" action="register.do" id="request_form">
<table>
	<tr>
		<td>
		<h2><fmt:message key="register.login"></fmt:message></h2>
		</td>
		<td><input type="text" name="login" id="login" /></td>
	</tr>
	<tr>
		<td>
		<h2><fmt:message key="register.name"></fmt:message></h2>
		</td>
		<td><input type="text" name="name" id="name" /></td>
	</tr>
	<tr>
		<td>
		<h2><fmt:message key="register.surname"></fmt:message></h2>
		</td>
		<td><input type="text" name="surname" id="surname" /></td>
	</tr>
	<tr>
		<td>
		<h2><fmt:message key="register.password"></fmt:message></h2>
		</td>
		<td><input type="password" name="pass"
			class="inputbox required password" value="" id="password" /></td>
	</tr>
	<tr>
		<td>
		<h2><fmt:message key="register.repeat"></fmt:message></h2>
		</td>
		<td><input type="password" name="pass_retry"
			class="inputbox required password" value="" id="password_confirm" />
		</td>
	</tr>
	<tr>
		<td>
		<h2>Email</h2>
		</td>
		<td><input type="text" name="email" id="email" /></td>
	</tr>
	<tr>
		<td align="center">
		
		<button type="submit" align="right" name="request_button"><fmt:message
			key="index.registration"></fmt:message></button>
		</td>
	</tr>
</table>
</form>
</body>
</html>